package com.codemate.interview.redis;

import com.codemate.interview.redis.extend.KeyDeleteEventMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * Redis键删除监听器
 *
 * @author hice
 * @apiNote 需要预先开启redis.config配置[notify-keyspace-events "Ex"]
 */
@Slf4j
public class RedisKeyDeletedEventListener extends KeyDeleteEventMessageListener {

    public RedisKeyDeletedEventListener(RedisMessageListenerContainer container) {
        super(container);
    }

    @Override
    public void onMessage(Message message, byte[] pattern) {
        log.debug("删除key: {}", message.toString());
    }
}
